window.onload = function () {
    var peopleList = document.querySelectorAll(".peopleBox");
    var nameList = document.querySelectorAll(".charactorItem p");
    var select = document.querySelector(".chacFoot");
    var imgList = document.querySelectorAll(".hide1"); //无色
    var image = document.querySelectorAll(".hide2"); //彩色图片
    var a = document.querySelector(".chacFoot a");
    var shenfen = document.querySelectorAll(".imgBox p");

    for (let i = 0; i < imgList.length; i++) {
        const ele = imgList[i];
        ele.onclick = function () {
            for (let j = 0; j < image.length; j++) {
                image[j].style.display = "none";
            }
            var aa= shenfen[i].getAttribute("id"); //获取元素ID的值
            if(aa==1){
                a.href="./teacher-info.html"
            }else if(aa==2){
                a.href="./qiye-info.html"
            }else if(aa==3){
                a.href="./student-info.html"
            }
            image[i].style.display = "block";
            nameList[i].style.color = "#323232";
            select.style.color = "#fff";
            select.style.background = "#0155ff";
        }
    }
}